stack: Update windows before allocating children
authorMatthias Clasen <mclasen@redhat.com>
Mon, 30 Nov 2015 15:35:04 +0000 (10:35 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 30 Nov 2015 15:41:13 +0000 (10:41 -0500)
Doing things the other way around seems to cause problems in
some cases where children want to do different things depending
on the window position.

https://bugzilla.gnome.org/show_bug.cgi?id=758563

gtk/gtkstack.c

index bc9e347899c79d8830c939660b5a4a7aee5a03df..09ee6560910963fd918b1255889783ed1909467c 100644 (file)
@@ -2183,6 +2183,16 @@ gtk_stack_size_allocate (GtkWidget     *widget,
 
   gtk_widget_set_allocation (widget, allocation);
 
+  if (gtk_widget_get_realized (widget))
+    {
+      gdk_window_move_resize (priv->view_window,
+                              allocation->x, allocation->y,
+                              allocation->width, allocation->height);
+      gdk_window_move_resize (priv->bin_window,
+                              get_bin_window_x (stack, allocation), get_bin_window_y (stack, allocation),
+                              allocation->width, allocation->height);
+    }
+
   child_allocation.x = 0;
   child_allocation.y = 0;
   child_allocation.width = allocation->width;
@@ -2218,16 +2228,6 @@ gtk_stack_size_allocate (GtkWidget     *widget,
           gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation);
         }
     }
-
-   if (gtk_widget_get_realized (widget))
-    {
-      gdk_window_move_resize (priv->view_window,
-                              allocation->x, allocation->y,
-                              allocation->width, allocation->height);
-      gdk_window_move_resize (priv->bin_window,
-                              get_bin_window_x (stack, allocation), get_bin_window_y (stack, allocation),
-                              allocation->width, allocation->height);
-    }
 }